//f[i]=sigema(f[i])+1
public class Solution940 {
    public int distinctSubseqII(String s) {
        long[] ans=new long[26];
        int m=1000000007;
        for (int i=0;i<s.length();i++){
            long sum=0;
            for (int i1 = 0; i1 < 26; i1++) {
                sum=(sum+ans[i1])%m;
            }
            ans[s.charAt(i)-'a']=(sum+1)%m;
        }
        long t=0;
        for (int i=0;i<ans.length;i++){
            t=(t+ans[i])%m;
        }
        return (int)t;
    }

    public static void main(String[] args) {
        System.out.println(new Solution940().distinctSubseqII("abc"));
    }
}
